package cn.edu.scau.cmi.linhongyu.singleton;

import javafx.fxml.FXML;

import javafx.scene.control.Button;

import javafx.scene.control.TextField;

import javafx.scene.control.TextArea;

public class MultitionController {
	@FXML
	private TextField input;
	@FXML
	private Button create;
	@FXML
	private TextArea msg;
	public void Event() {
		int num = Marshal.getCount();
		Marshal marshal = Marshal.getInstance(input.getText());
		
		if(marshal==null) {
			msg.appendText("你已创建十个元帅，无法继续添加\n");
		}
		else if(num<Marshal.getCount())
			msg.appendText("已成功创建第"+Marshal.getCount()+"个对象："+marshal.getName()+marshal+'\n');
		else
			msg.appendText("该元帅已经创建\n，对象为："+marshal.getName()+marshal+'\n');
	}
}